﻿<?php require_once('../Connections/STN.php'); ?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}


//classificação

//album 
mysql_select_db($database_STN, $STN);
$query_RSalbum = "SELECT alb.*,usu. USU_NOME FROM tb_albuns alb join tb_usuarios usu ON (alb.ALB_USU_CODIGO=usu.USU_CODIGO);";
$RSalbum = mysql_query($query_RSalbum, $STN) or die(mysql_error());
$row_RSalbum = mysql_fetch_assoc($RSalbum);
$totalRows_RSalbum = mysql_num_rows($RSalbum);

//converte data do banco para br  
function bancobr($databanco){
		$ano = substr($databanco, 0, 4);
		$mes = substr($databanco, 5, 2);
		$dia = substr($databanco, 8, 2);
		$hora = substr($databanco,11, 5);
		$databr = $hora. " - ". $dia . "/" . $mes . "/" . $ano;
		return $databr;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link  href="css/admin.css" rel="stylesheet" type="text/css" />
<title>Adiministrador</title>
</head>
<body>
<div id="main">
<div id="header">
            <a href="#" class="logo"><img src="img/logo.gif" width="101" height="29" alt="" /></a>
            <ul id="top-navigation">
            	<li><a href="index.php">INDEX</a></li>
                <li><a href="postagem-lista.php">POSTAGENS</a></li>
                <li><a href="arquivos-lista.php">ARQUIVOS</a></li>
                <li><a href="album-lista.php"class="active">FOTOS ANTIGAS</a></li>
                <li><a href="videos-lista.php">VIDEOS</a></li>
            </ul>
			<div class="logout">
        	<a href="logout.php"><img src="img/logout.png" /></a>
            </div>
        </div>
        <div id="middle">
<div id="left-column">
                <h3>FOTOS</h3>
                
                
            </div>
            <div id="center-column">
                <div class="top-bar">
                  <a href="album-cadastra.php" class="button">ADD ALBUM</a>
                    <h1>ALBUM DE FOTOS ANTIGAS</h1>
                </div>
<div class="table">
             <table class="listing" cellpadding="0" cellspacing="0">
             	<tr>
                    <th>Título</th>
                    <th>Última alteração</th>
                    <th>Quem cadastrou</th>
                    <th>Visualizar</th>
                    <th>Editar</th>
                    <th>Apagar</th>
               </tr>
                 <?php do { ?>
                 <tr>
                 
                 	
       	           <td><?php echo $row_RSalbum['ALB_TITULO'] ?></td>
               	     <td><?php echo bancobr($row_RSalbum['ALB_DATA_CADASTRO']) ?></td>
               	     <td><?php echo $row_RSalbum['USU_NOME'] ?></td>
               	     <td><a href="fotos-lista.php?album=<?php echo $row_RSalbum['ALB_CODIGO'] ?>"><img src="img/ir.png" width="16" height="16" title="clique para ver as fotos desse album" /> </a></td>
                     <td><a href="album-altera.php?album=<?php echo $row_RSalbum['ALB_CODIGO'] ?>">
               	     <img src="img/edit-icon.gif" width="16" height="16" title="Clique para altera"/>
               	    </a></td>
               	     <td><a href="album-apaga.php?album=<?php echo $row_RSalbum['ALB_CODIGO'] ?>"><img src="img/hr.gif" width="16" height="16" alt="save" title="clique para apagar" /></a></td>
                 </tr>
                  <?php } while ($row_RSalbum = mysql_fetch_assoc($RSalbum)); ?>

</table>
</div>

</div>
            <div id="right-column">
                <strong class="h">SUPORTE</strong>
                <div class="box">O suporte tecnico funciona de segunda a sexta no horario de 9:30h as 18h pelo telefone:  (84)8759-6187 / (84)9675-2663 robertojuniorluiz16 @gmail.com</div>
<!--fim do conteudo-->
            </div>
        </div>
        <div id="footer"><p>&copy;COPYRIGHT <a href="http://twitter.com/jrnescau" target="_blank">Nescau</a> e <a href="http://twitter.com/JessuirCleydson" target="_blank">Jessuir</a> 2012. </p></div>
</div>
</body>
</html>
<?php
mysql_free_result($RSalbum);
?>
